package com.jinsi.service.yrf.iml;
import com.jinsi.constant.YrfConstant;
import com.jinsi.mapper.yrf.BackgroundManagementPersonnelListMapper;
import com.jinsi.pojo.Department;
import com.jinsi.pojo.SyUser;
import com.jinsi.pojo.SyUserSeal;
import com.jinsi.service.yrf.BackgroundmanagementpersonnellistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional
public class BackgroundmanagementpersonnellistServiceImpl implements BackgroundmanagementpersonnellistService {
    @Autowired
    private BackgroundManagementPersonnelListMapper balistMapper;

    @Override
    public List<Department> getTree() {
        return balistMapper.getTree(YrfConstant.DEPTSTATE);
    }

    @Override
    public List<SyUser> getAll(Integer aa, String userAccount, String userNickname, String deptName, Date userCreateDate) {
        return balistMapper.getAll(aa,userAccount,userNickname,deptName,userCreateDate,YrfConstant.DEPTSTATE);
    }

    @Override
    public void updatedeptEnableStatus(int userId, int userEnableStatus) {
        balistMapper.updatedeptEnableStatus(userId,userEnableStatus);
    }

    @Override
    public void updatedeptuserStats(int userId, int userStats) {
        balistMapper.updatedeptuserStats(userId,userStats);
    }

    @Override
    public List<SyUser> see(int userId) {
        return balistMapper.see(userId);
    }

    @Override
    public void syuserbj(Integer userId,String userNickname,String userUrl,int userSex,String userPhone,String userIdCard,
                         Date userDateBirth, String deptName, String userEmail) throws Exception{
        int num = balistMapper.syuserbj(userId, userNickname, userUrl, userSex, userPhone, userIdCard,
                userDateBirth, deptName, userEmail);
        if(num == 0){
            throw new Exception();
        }

    }


    @Override
    public void syuserbjft(SyUserSeal syUserSeal) throws Exception {

            int num = balistMapper.syuserbjft(syUserSeal);
            if(num == 0){
                throw new Exception();
            }


    }

    @Override
    public SyUserSeal syuserckft(Integer userId) {
        return balistMapper.syuserckft(userId);
    }

    /**
     * 追加天数
     */
    @Override
    public void syuserbjft2(SyUserSeal syUserSeal) throws Exception {
        int num = balistMapper.syuserbjft2(syUserSeal);
        if(num == 0){
            throw new Exception();
        }
    }
}
